home *** CD-ROM | disk | FTP | other *** search
/ Sony Community Place / BROWSER / APP / CHAT / CHATROOM.EXE / program files / Sony / Community Place Browser / world / chatroom / scripts / lights.java < prev    next >
Encoding:
Java Source  |  1996-12-12  |  1.3 KB  |  61 lines

  1. /*
  2.  * Copyright(C) 1996 Sony Corporation. All rights reserved.
  3.  */
  4.  
  5. import vrml.*;
  6. import vrml.field.*;
  7. import vrml.node.*;
  8. import java.util.*;
  9. import vs.*;
  10.  
  11. public class lights extends Script{
  12.     /* Node */
  13.     SFNode        SwNode;
  14.  
  15.     /* EventOut */
  16.     //SFBool        SwTimeSensorEnabled;
  17.     SFTime        SwTimeSensorStartTime;
  18.  
  19.     public void initialize() {
  20.         /* Node */
  21.         SwNode                = (SFNode) getField( "SwNode" );
  22.     
  23.         /* EventOut */
  24.         //SwTimeSensorEnabled        = (SFBool) getEventOut( "SwTimeSensorEnabled" );
  25.         SwTimeSensorStartTime        = (SFTime) getEventOut( "SwTimeSensorStartTime" );
  26.     }
  27.  
  28.     public void processEvent(Event e) {
  29.         String name = e.getName () ;
  30.     
  31.         if(name.equals("SwTouchSensorIsActive")) {    SwTouchSensorIsActive(e);    }
  32.         if(name.equals("SwShareTouched")){            SwShareTouched(e);        }
  33.     }
  34.  
  35.     public void SwTouchSensorIsActive(Event e) {
  36.         double time = e.getTimeStamp();
  37.         ConstSFBool mouse_down = (ConstSFBool)e.getValue();
  38.     
  39.         if (mouse_down.getValue()) return;    /* mouseDown */
  40.         
  41.         SwStart( time );
  42.         Vscp.sendApplSpecificMsgWithDist( SwNode, "SwShareTouched", "void", Vscp.allClientsExceptMe );
  43.     }
  44.  
  45.     public void SwShareTouched(Event e) {
  46.         double time = e.getTimeStamp();
  47.     
  48.         SwStart( time );
  49.  
  50.     }
  51.  
  52.     public void SwStart ( double time ) {
  53.     
  54.         SwTimeSensorStartTime.setValue( time );
  55.     
  56.     }
  57. }
  58.  
  59.  
  60. 
  61.